<eq name="requestfirst" value="1">
    <input type="hidden" id="requestfirst" value="1">
</eq>
<style>
.form-pure{width:100%;border: none;outline: none;color: #6dc4a2;padding: 5px 0; background:none;}
.panel-invite h5{ margin-bottom:15px;}
</style>
<div class=" panel-invite">
    <div class="">
        <h6 class="hidden text-muted">本公司还暂无部门哦！请立即<a href="{:U('Member_position/index')}" target="_blank">建立组织架构</a></h6>
        <div class="row">
            <div class="col-xs-6">
    			<h5>选择要邀请的人的所属角色</h5>
                <div class="" data-position="bottom" data-intro="您想邀请哪类人员进入系统呢？请选择一个！">
                
                <html:dropdownselect class="memberselect1" selected="" name="group" style="height:auto; width:auto;" multi="0" action="{:U('Team/membergrouplist')}" title="点击这里选择角色" placeholder="点击这里选择角色" />
                
                </div>
            </div>
            <div class="col-xs-6">
    			<h5>选择要邀请的人的所属部门</h5>
            	<div id="" class=" tree-plus-minus" data-position="bottom" data-intro="请选择一个部门，邀请进入系统的人员将自动分配到该部门！">
                    <html:dropdownselect class="memberselect2" selected="" name="position" style="height:auto; width:auto;" multi="0" action="{:U('Team/positionlist')}" title="点击这里选择部门" placeholder="点击这里选择部门" />
                </div>
            </div>
        </div>
    	<form id="inviteform" action="{:U('getInvite')}" method="post">
        	<input type="hidden" name="id" id="id"/>
            <input type="hidden" name="gid" id="gid"/>
        </form>
        <aside class="aside-invite hidden">
        	<hr/>
            <label></label>的邀请链接：<br/>
            <small><input class="form-pure" type="text" value="http://weixin.xb363.com/13/Intesys/Public/signin.html"/></small>
            <div class="text-muted">请右键复制以上链接，并到并发送到公司员工即可快速注册系统 。</div>
        </aside>
     </div>
</div>  
<link rel="stylesheet" type="text/css" href="__PUBLIC__/Intesys/AdminX/js/fuelux/css/tree-style.css"/>
<script src="__PUBLIC__/Intesys/AdminX/js/fuelux/js/tree.min.js"></script>
<script>
$(window).trigger('load');
//角色选项点击切换并更改文字和值
$('.tab').each(function(){
	$(this).click(function(){
		val=$(this).attr('value');
		setter=$(this).attr('pre');
		$("#inviteform #id").val($(this).val());
		$('.typebtn').html(setter+" <span class='caret'></span>");
        if($("#inviteform #gid").val()){
            getInvite();
        }else{

        }
	});
});


$('.memberselect1').blur(function(e) {
    var gid = $(this).find('input[name="group_id"]').val();
	$("#inviteform #gid").val(gid)
	getInvite();
});

$('.memberselect2').blur(function(e) {
	var id = $(this).find('input[name="position_id"]').val();
    $("#inviteform #id").val(id);
	getInvite();
});

//树的配置数据

//生成部门树

//移动到链接上就全选
$(".aside-invite input:text").mouseover(function(e){
    $(this).select();
});
//异步获取邀请链接
function getInvite(){
	
	if($("#inviteform #gid").val() == 0 || $("#inviteform #id").val() == 0){
		return false;
	}
	
	var formObj=$("#inviteform");
	$.getJSON(formObj.attr("action"),formObj.serialize(),function(data){
		if(data.statu){
			$(".aside-invite").removeClass("hidden").find("input").val(data.tbody);
		}
	});
	setTimeout(function(){
		if($(".aside-invite").hasClass("hidden")){
			$.ThinkBox.error('获取失败，请重试！', {'delayClose': 800});	
		}	
	},500);
}
</script>